package com.lzj.demo.design.decorator;

import lombok.extern.slf4j.Slf4j;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * 具体装饰角色:扩展装饰具体的实现逻辑
 * */
@Slf4j
public class LoginSsoDecorator extends SsoDecorator{
    private static final Map<String,String> authMap = new ConcurrentHashMap<>();
    static {
        authMap.put("1001","Faker");
        authMap.put("1002","Suzy");
    }

    public LoginSsoDecorator(SsoInterceptor ssoInterceptor) {
        super(ssoInterceptor);
    }

    public boolean preHandler(String userId ,String flag) throws Exception {
        log.info("模拟单点登录方法访问拦截校验:用户ID={},用户名={}",userId,authMap.get(userId));
        return super.preHandler(flag);
    }
}
